package com.wt.admin.mapper.sys;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wt.admin.domain.dto.sys.DataPermissionsTablesDTO;
import com.wt.admin.domain.entity.sys.SysDataPermissionsEntity;
import com.wt.admin.domain.vo.DataPermissionsFieldsVO;
import com.wt.admin.domain.vo.DataPermissionsTablesVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface SysDataPermissionsMapper extends BaseMapper<SysDataPermissionsEntity> {

    List<SysDataPermissionsEntity> findRoleIdBydDataPermissions(@Param("data") Integer roleId);

    @Select("select * from sys_data_permissions order by create_time desc")
    IPage<SysDataPermissionsEntity> find(Page<SysDataPermissionsEntity> page, SysDataPermissionsEntity data);

    List<DataPermissionsTablesVO> findByTables(@Param("data") SysDataPermissionsEntity data);

    List<DataPermissionsFieldsVO> findByFields(@Param("data") SysDataPermissionsEntity data);

    List<Object> findByFieldValue(@Param("data") DataPermissionsTablesDTO data);
}
